package com.ccs.user.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ccs.user.service.UserService;
import com.ccs.utils.HTMLUtil;
import com.ccs.utils.ResultWrap;

@Controller
@RequestMapping("/user")
public class UserController {
	
	@Autowired
	private UserService userService;

	//测试
	@RequestMapping("/test")
	public void test(HttpServletRequest request,HttpServletResponse response) throws Exception{
		try {
			ResultWrap resultWrap = HTMLUtil.getResultWrap();
			Map<String,Object> requestMap = HTMLUtil.getPageParams(request);
			resultWrap.setData(userService.testUsers(requestMap));
			System.out.println(resultWrap);
			HTMLUtil.sendWrap(response, resultWrap, request);
		} catch (Exception e) {
			e.printStackTrace();
			response.getWriter().write("错误信息："+e);
		}
	}
	
}
